import { mergeWithoutArray } from '@/utils';
import {
  BASIC_DEFAULT_CONFIG,
  BASIC_DEFAULT_DATA_CONFIG,
  BASIC_DEFAULT_INTERACTIVE_CONFIG,
  DEFAULT_CONDITION_CONFIG,
  DEFAULT_LINKAGE_CONFIG,
} from '../../Common/Constants/defaultConfig';
import ThemeUtil from '@/utils/Assist/Theme';
import { TPathBasicConfig } from './type';

const DEFAULT_VALUE = {
  value:
    'M8,56 C8,33.90861 25.90861,16 48,16 C70.09139,16 88,33.90861 88,56 C88,78.09139 105.90861,92 128,92 C150.09139,92 160,72 160,56 C160,40 148,24 128,24 C108,24 96,40 96,56 C96,72 105.90861,92 128,92 C154,93 168,78 168,56 C168,33.90861 185.90861,16 208,16 C230.09139,16 248,33.90861 248,56 C248,78.09139 230.09139,96 208,96 L48,96 C25.90861,96 8,78.09139 8,56 Z',
};

export default () => {
  const color = ThemeUtil.generateNextColor4CurrentTheme(0);
  const CUSTOM_CONFIG: ComponentData.TInternalComponentConfig<TPathBasicConfig> =
    {
      interactive: {
        base: [],
        linkage: [
          {
            ...DEFAULT_LINKAGE_CONFIG,
            type: 'click',
            name: '点击',
          },
        ],
      },
      data: {
        request: {
          value: DEFAULT_VALUE,
          valueType: 'object',
        },
        filter: {
          map: [
            {
              field: 'value',
              map: '',
              description: '路径',
              id: 'value',
              type: 'string',
            },
          ],
        },
      },
      options: {
        close: false,
        target: {
          type: 'custom',
          circle: {
            radius: 20,
            color,
          },
          rect: {
            width: 20,
            height: 20,
            color,
          },
          custom: {
            width: 20,
            height: 20,
            value:
              '',
          },
        },
        animation: {
          type: 'to',
          opacity: 'none',
          autoRotate: true,
          moveType: 'linear',
          speed: 6000,
        },
        path: {
          show: true,
          line: 'solid',
          dashedValue: '10, 5',
          width: 1,
          color: {
            r: 255,
            g: 255,
            b: 255,
          },
        },
        condition: DEFAULT_CONDITION_CONFIG(),
      },
    };

  const DefaultConfig: ComponentData.TComponentData<TPathBasicConfig> =
    mergeWithoutArray(
      {},
      {
        data: BASIC_DEFAULT_DATA_CONFIG,
        interactive: BASIC_DEFAULT_INTERACTIVE_CONFIG,
      },
      BASIC_DEFAULT_CONFIG,
      {
        style: {
          width: 260,
          height: 160,
        },
      },
      CUSTOM_CONFIG,
    );
  return DefaultConfig;
};

export const themeConfig = {
  convert: (colorList: string[]) => {
    return {};
  },
};
